package com.bsfcs.rag.utils;

import com.bsfcs.rag.entity.Counterpart;
import com.bsfcs.rag.entity.Industry;
import com.bsfcs.rag.entity.PaymentMethod;
import org.springframework.util.StringUtils;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class CacheUtils {
    /**
     * 结算方式
     */
    private static final Map<String, PaymentMethod> PAYMENT_METHOD_CACHE = new ConcurrentHashMap<>();
    /**
     * 行业字典
     */
    private static final Map<String, Industry> INDUSTRY_CACHE = new ConcurrentHashMap<>();


    private static final Map<String, Counterpart> COUNTERPART_CACHE = new ConcurrentHashMap<>();

    public static void putPaymentMethod(String key, PaymentMethod paymentMethod) {
        PAYMENT_METHOD_CACHE.put(key, paymentMethod);
    }

    // 根据键获取支付方式
    public static PaymentMethod getPaymentMethod(String key) {
        return PAYMENT_METHOD_CACHE.get(key);
    }



    public static void putIndustry(String key, Industry industry) {
        INDUSTRY_CACHE.put(key, industry);
    }


    public static Industry getIndustry(String key) {
        return INDUSTRY_CACHE.get(key);
    }

    public static void putCounterpart(String key, Counterpart counterpart) {
        COUNTERPART_CACHE.put(key, counterpart);
    }


    public static Counterpart getCounterpart(String key) {
        return COUNTERPART_CACHE.get(key);
    }
}